package com.lsh.timerTask;

import com.lsh.controller.TestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author ：LiuShihao
 * @date ：Created in 2020/6/23 8:08 下午
 * @desc ：
 */
@Component
public class FindBlogTask {

    @Autowired
    TestController controller;
    private boolean isRun = false;
    //* 30 0/1 * * ?
    @Scheduled(cron="0 */1 * * * ?")
    @Transactional
    public void SendFailedMsg(){
        System.out.println("+++++++++++++++++++FindBlogTask+++++++++++++++++++");
        if (isRun) {
            return;// 正在运行，略过本次
        }
        isRun = true;
        controller.fingBlog();
        isRun = false;
    }




}
